export const fileTypeIconMap = {
    ppt: `images/file-type/ppt.png`,
    txt: `images/file-type/txt.png`,
    pdf: `images/file-type/pdf.png`,

    // 图片
    bmp: `images/file-type/photo.png`,
    jpg: `images/file-type/photo.png`,
    png: `images/file-type/photo.png`,
    tif: `images/file-type/photo.png`,
    gif: `images/file-type/photo.png`,
    pcx: `images/file-type/photo.png`,
    tga: `images/file-type/photo.png`,
    exif: `images/file-type/photo.png`,
    fpx: `images/file-type/photo.png`,
    svg: `images/file-type/photo.png`,
    psd: `images/file-type/photo.png`,
    cdr: `images/file-type/photo.png`,
    pcd: `images/file-type/photo.png`,
    dxf: `images/file-type/photo.png`,
    ufo: `images/file-type/photo.png`,
    eps: `images/file-type/photo.png`,
    ai: `images/file-type/photo.png`,
    raw: `images/file-type/photo.png`,
    WMF: `images/file-type/photo.png`,
    webp: `images/file-type/photo.png`,
    avif: `images/file-type/photo.png`,
    apng: `images/file-type/photo.png`,

    doc: `images/file-type/word.png`,
    docx: `images/file-type/word.png`,

    xls: `images/file-type/xlsx.png`,
    xlsx: `images/file-type/xlsx.png`,
    xlsm: `images/file-type/xlsx.png`,

    // 视频
    avi: `images/file-type/video.png`,
    wmv: `images/file-type/video.png`,
    mpeg: `images/file-type/video.png`,
    mpeg1: `images/file-type/video.png`,
    mpeg2: `images/file-type/video.png`,
    'divx/xvid': `images/file-type/video.png`,
    dv: `images/file-type/video.png`,
    mkv: `images/file-type/video.png`,
    mov: `images/file-type/video.png`,
    ogg: `images/file-type/video.png`,
    mod: `images/file-type/video.png`,
    asf: `images/file-type/video.png`,
    asx: `images/file-type/video.png`,
    rm: `images/file-type/video.png`,
    rmvb: `images/file-type/video.png`,
    mp4: `images/file-type/video.png`,
    '3gp': `images/file-type/video.png`,
    m4v: `images/file-type/video.png`,
    dat: `images/file-type/video.png`,
    flv: `images/file-type/video.png`,
    vob: `images/file-type/video.png`,
    avchd: `images/file-type/video.png`,
    webm: `images/file-type/video.png`,

    // 音乐
    WAV: `images/file-type/music.png`,
    FLAC: `images/file-type/music.png`,
    APE: `images/file-type/music.png`,
    ALAC: `images/file-type/music.png`,
    'WavPack(WV)': `images/file-type/music.png`,
    MP3: `images/file-type/music.png`,
    AAC: `images/file-type/music.png`,
    Ogg: `images/file-type/music.png`,
    Vorbis: `images/file-type/music.png`,
    Opus: `images/file-type/music.png`,

    // 压缩
    rar: `images/file-type/zip.png`,
    zip: `images/file-type/zip.png`,
    cab: `images/file-type/zip.png`,
    iso: `images/file-type/zip.png`,
    jar: `images/file-type/zip.png`,
    ace: `images/file-type/zip.png`,
    '7z': `images/file-type/zip.png`,
    tar: `images/file-type/zip.png`,
    gz: `images/file-type/zip.png`,
    arj: `images/file-type/zip.png`,
    lzh: `images/file-type/zip.png`,
    uue: `images/file-type/zip.png`,
    bz2: `images/file-type/zip.png`,
    z: `images/file-type/zip.png`,

    folder: `images/file-type/folder.png`,
    http: `images/file-type/link.png`,
    https: `images/file-type/link.png`,
    rest: `images/file-type/rests.png`,
}

/**
 * 传入url 获取 url中的后缀名
 * @param url string
 * @returns  二进制图片
 */
export const getHttpSuffix = (url: string) => {
    const suffixIndex = url.lastIndexOf('.')
    if (!~suffixIndex) return undefined

    const suffix = url.slice(suffixIndex + 1, url.length)
    return suffix as keyof typeof fileTypeIconMap
}
